package com.example.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

@Configuration
public class Myconfig {
    @Bean
    public MybatisPlusInterceptor mpl(){
        MybatisPlusInterceptor mp=new MybatisPlusInterceptor();
        mp.addInnerInterceptor(new PaginationInnerInterceptor());
        return mp;
    }
    @Bean
    public LocalValidatorFactoryBean validator(){
        LocalValidatorFactoryBean ll = new LocalValidatorFactoryBean();
        ll.setProviderClass(HibernateValidator.class);
        return ll;
   }
    //文件上传
    @Bean
    public CommonsMultipartResolver commonsMultipartResolver(){
        CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
        commonsMultipartResolver.setDefaultEncoding("utf-8");
        commonsMultipartResolver.setMaxInMemorySize(2000000000);
        return commonsMultipartResolver;
    }

}
